\(\int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx\) [3]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 24, antiderivative size = 46 \[ \int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=a (A-i B) x-\frac {a (i A+B) \log (\cos (c+d x))}{d}+\frac {i a B \tan (c+d x)}{d} \]

[Out]

a*(A-I*B)*x-a*(I*A+B)*ln(cos(d*x+c))/d+I*a*B*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {3606, 3556} \[ \int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {a (B+i A) \log (\cos (c+d x))}{d}+a x (A-i B)+\frac {i a B \tan (c+d x)}{d} \]

[In]

Int[(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

a*(A - I*B)*x - (a*(I*A + B)*Log[Cos[c + d*x]])/d + (I*a*B*Tan[c + d*x])/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rubi steps \begin{align*} \text {integral}& = a (A-i B) x+\frac {i a B \tan (c+d x)}{d}+(a (i A+B)) \int \tan (c+d x) \, dx \\ & = a (A-i B) x-\frac {a (i A+B) \log (\cos (c+d x))}{d}+\frac {i a B \tan (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.43 \[ \int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=a A x-\frac {i a B \arctan (\tan (c+d x))}{d}-\frac {i a A \log (\cos (c+d x))}{d}-\frac {a B \log (\cos (c+d x))}{d}+\frac {i a B \tan (c+d x)}{d} \]

[In]

Integrate[(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]

[Out]

a*A*x - (I*a*B*ArcTan[Tan[c + d*x]])/d - (I*a*A*Log[Cos[c + d*x]])/d - (a*B*Log[Cos[c + d*x]])/d + (I*a*B*Tan[
c + d*x])/d

Maple [A] (verified)

Time = 0.04 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.09

method result size
derivativedivides \(\frac {a \left (i B \tan \left (d x +c \right )+\frac {\left (i A +B \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-i B +A \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(50\)
default \(\frac {a \left (i B \tan \left (d x +c \right )+\frac {\left (i A +B \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-i B +A \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(50\)
norman \(\left (-i a B +a A \right ) x +\frac {i a B \tan \left (d x +c \right )}{d}+\frac {\left (i a A +B a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(52\)
parts \(A a x +\frac {\left (i a A +B a \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {i a B \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(55\)
parallelrisch \(\frac {-2 i B x a d +i A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a +2 A x a d +2 i B \tan \left (d x +c \right ) a +B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a}{2 d}\) \(61\)
risch \(\frac {2 i a B c}{d}-\frac {2 a A c}{d}-\frac {2 a B}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}-\frac {i a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{d}\) \(78\)

[In]

int((a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*a*(I*B*tan(d*x+c)+1/2*(I*A+B)*ln(1+tan(d*x+c)^2)+(A-I*B)*arctan(tan(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 64, normalized size of antiderivative = 1.39 \[ \int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {2 \, B a - {\left ({\left (-i \, A - B\right )} a e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-i \, A - B\right )} a\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]

[In]

integrate((a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

-(2*B*a - ((-I*A - B)*a*e^(2*I*d*x + 2*I*c) + (-I*A - B)*a)*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(2*I*d*x + 2*I*
c) + d)

Sympy [A] (verification not implemented)

Time = 0.23 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.15 \[ \int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=- \frac {2 B a}{d e^{2 i c} e^{2 i d x} + d} - \frac {i a \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} \]

[In]

integrate((a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)

[Out]

-2*B*a/(d*exp(2*I*c)*exp(2*I*d*x) + d) - I*a*(A - I*B)*log(exp(2*I*d*x) + exp(-2*I*c))/d

Maxima [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.09 \[ \int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {2 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a - {\left (-i \, A - B\right )} a \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 i \, B a \tan \left (d x + c\right )}{2 \, d} \]

[In]

integrate((a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*(2*(d*x + c)*(A - I*B)*a - (-I*A - B)*a*log(tan(d*x + c)^2 + 1) + 2*I*B*a*tan(d*x + c))/d

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 103 vs. \(2 (40) = 80\).

Time = 0.30 (sec) , antiderivative size = 103, normalized size of antiderivative = 2.24 \[ \int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {-i \, A a e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - B a e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - i \, A a \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - B a \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 2 \, B a}{d e^{\left (2 i \, d x + 2 i \, c\right )} + d} \]

[In]

integrate((a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

(-I*A*a*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - B*a*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1
) - I*A*a*log(e^(2*I*d*x + 2*I*c) + 1) - B*a*log(e^(2*I*d*x + 2*I*c) + 1) - 2*B*a)/(d*e^(2*I*d*x + 2*I*c) + d)

Mupad [B] (verification not implemented)

Time = 7.80 (sec) , antiderivative size = 38, normalized size of antiderivative = 0.83 \[ \int (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B\,a+A\,a\,1{}\mathrm {i}\right )}{d}+\frac {B\,a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}{d} \]

[In]

int((A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i),x)

[Out]

(log(tan(c + d*x) + 1i)*(A*a*1i + B*a))/d + (B*a*tan(c + d*x)*1i)/d